Component({
  options: { pureDataPattern: /^_/ },
  properties: { timeOut: { type: Number, value: 0 } },
  data: { showTime: '', _Timer_cartHint: null },
  attached: function () {
    var t = this.properties.timeOut;
    t && this.countDown(t);
  },
  detached: function () {
    console.log('hint detached in'),
      clearTimeout(this.data._Timer_cartHint),
      (this.data._Timer_cartHint = null);
  },
  methods: {
    countDown: function (t) {
      var a = this;
      clearTimeout(this.data._Timer_cartHint),
        (this.data._Timer_cartHint = setTimeout(function () {
          var e = t - 1,
            i = Math.floor(e / 86400),
            o = e % 86400,
            n = Math.floor(o / 3600),
            r = o % 3600,
            c = Math.floor(r / 60),
            u = (r % 60) % 60,
            m = ''
              .concat(i ? i + '天' : '')
              .concat(n >= 10 ? n : '0' + n, ':')
              .concat(c >= 10 ? c : '0' + c, ':')
              .concat(u >= 10 ? u : '0' + u);
          a.setData({ showTime: m }),
            e > 0
              ? a.countDown(e)
              : (a.outTime(),
                clearTimeout(a.data._Timer_cartHint),
                (a.data._Timer_cartHint = null));
        }, 1e3));
    },
  },
});
